package StudyCode.summary.myfile;

import java.io.File;

/**
 * 版权所有 科技与人文(www.tah1986.com)
 */
public class RenamingFilesUsingFileObject {
	public static void main(String[] args) {
		File oldName = new File("E:\\Copy\\test.txt");
		File newName = new File("E:\\Copy\\test1.txt");
		boolean isFileRenamed = oldName.renameTo(newName);
		if (isFileRenamed) {
			System.out.println(oldName + " 重命名为 " + newName + " 成功。");
		} else {
			System.out.println("重命名失败。");
		}
	}
}
